package com.ruoyi.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.service.IUnreadCountService;

/**
 * 未读消息数Controller
 *
 * @author qyb
 * @date 2023-12-26
 */
@RestController
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RequestMapping("/message")
public class UnreadCountController extends BaseController {

    private final IUnreadCountService unreadCountService;

    /**
     * 获取用户未阅读数
     * @return
     */
    @GetMapping("count")
    public AjaxResult getCount(){
        return unreadCountService.getUnReadCount();
    }


//    /**
//     * 查询未读消息数列表
//     */
//    @PreAuthorize("@ss.hasPermi('message:count:list')")
//    @GetMapping("/list")
//    public TableDataInfo list(UnreadCount unreadCount)
//    {
//        startPage();
//        List<UnreadCount> list = unreadCountService.selectUnreadCountList(unreadCount);
//        return getDataTable(list);
//    }
//
//    /**
//     * 导出未读消息数列表
//     */
//    @PreAuthorize("@ss.hasPermi('message:count:export')")
//    @Log(title = "未读消息数", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, UnreadCount unreadCount)
//    {
//        List<UnreadCount> list = unreadCountService.selectUnreadCountList(unreadCount);
//        ExcelUtil<UnreadCount> util = new ExcelUtil<UnreadCount>(UnreadCount.class);
//        util.exportExcel(response, list, "未读消息数数据");
//    }
//
//    /**
//     * 获取未读消息数详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('message:count:query')")
//    @GetMapping(value = "/{uuid}")
//    public AjaxResult getInfo(@PathVariable("uuid") Long uuid)
//    {
//        return success(unreadCountService.selectUnreadCountByUuid(uuid));
//    }
//
//    /**
//     * 新增未读消息数
//     */
//    @PreAuthorize("@ss.hasPermi('message:count:add')")
//    @Log(title = "未读消息数", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody UnreadCount unreadCount)
//    {
//        return toAjax(unreadCountService.insertUnreadCount(unreadCount));
//    }
//
//    /**
//     * 修改未读消息数
//     */
//    @PreAuthorize("@ss.hasPermi('message:count:edit')")
//    @Log(title = "未读消息数", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody UnreadCount unreadCount)
//    {
//        return toAjax(unreadCountService.updateUnreadCount(unreadCount));
//    }
//
//    /**
//     * 删除未读消息数
//     */
//    @PreAuthorize("@ss.hasPermi('message:count:remove')")
//    @Log(title = "未读消息数", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{uuids}")
//    public AjaxResult remove(@PathVariable Long[] uuids)
//    {
//        return toAjax(unreadCountService.deleteUnreadCountByUuids(uuids));
//    }
}
